package test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Demo1 {
	public static void main(String[] args) {
		try {
			Process process = Runtime.getRuntime().exec("ping 192.168.1.155");
			InputStream is = process.getInputStream();
			BufferedReader reader = new BufferedReader(new InputStreamReader(is, "gbk"));
			StringBuilder builder = new StringBuilder();
			while(reader.readLine() != null) {
				if (reader.readLine().length() != 0) {
					builder.append(reader.readLine() + "\r\n");
				}
			}
			System.out.println("获取的数据" + builder.toString());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
